<?php
//
// +------------------------------------------------------------------------+
// | PHP Version 5.4                                                        |
// +------------------------------------------------------------------------+
// | Copyright (c) All rights reserved.                                     |
// +------------------------------------------------------------------------+
// | 世纪车来车往(北京）网络科技有限公司 版权所有!                                |
// | TEL:010-63732365  HOTLINE:400-6688-365  EMAIL:clcw@clcw.com.cn         |
// | $Revision: 1.0 $                                                       |
// +------------------------------------------------------------------------+
// | Author: angl<anguolei@clcw.com.cn>                                     |
// +------------------------------------------------------------------------+
//
namespace AuctionCore\Broker;

/**
 * 红包类
 * Class RedPackets
 * @author angl
 */
class RedPackets
{
    public function __construct()
    {
    }

    /**
     * 新增红包记录
     * @param $aid
     * @param $other_aid
     * @param $type
     * @param $amount
     * @return bool|mixed
     */
    public static function add($aid, $other_aid, $type, $amount)
    {
        if (intval($aid) < 1 || intval($other_aid) < 1 || $type < 1 || $amount < 1) {
            return false;
        }
        $data = array(
            'aid' => $aid,
            'other_aid' => $other_aid,
            'type' => $type,
            'amount' => $amount,
            'create_time' => date('Y-m-d H:i:s')
        );
        $rp_id = M('red_packets')->add($data);
        return $rp_id;
    }


}